import request from "@/api/request";

/**
 * 获取分页列表
 * @param params 参数
 */
export function getPage(params: SearchListParams) {
  return request({
    url: "/system/dict/type/page",
    method: "get",
    params: params,
  });
}

/**
 * 获取列表
 * @param params 参数
 */
export function getList(params: SearchListParams) {
  return request({
    url: "/system/dict/type/list",
    method: "get",
    params: params,
  });
}

/**
 * 获取详情
 * @param params 参数
 */
export function getInfo(params: number) {
  return request({
    url: "/system/dict/type/" + params,
    method: "get"
  });
}

/**
 * 新增
 * @param params 参数
 */
export function saveInfo(params: DataInfo) {
  return request({
    url: "/system/dict/type/save",
    method: "post",
    data: params,
  });
}

/**
 * 修改
 * @param params 参数
 */
export function editInfo(params: DataInfo) {
  return request({
    url: "/system/dict/type/update",
    method: "post",
    data: params,
  });
}

/**
 * 删除
 * @param params 参数
 */
export function deleteInfo(params: number | number[]) {
  return request({
    url: "/system/dict/type/remove/" + params.toString(),
    method: "get"
  });
}

export interface SearchListParams {
    pageNum: number;
    pageSize: number;
    dictName: string;
    dictKey: string;
}

export interface DataInfo {
    id: number | null;
    dictName: string;
    dictKey: string;
    remark: string;
}

export interface TableData {
    id: number;
    dictName: string;
    dictKey: string;
    createTime: string;
    updateTime: string;
    remark: string;
}